<template>
	<view>
		<view class="pl20 pr20 mt40 jobitem pt32 pb40"
			@click="data.type?$jump('/pages/common/jobDetail/jobDetail?id='+data.id+'&type='+data.type):''">
			<view class="">
				<view class="jobtit">{{data.title}}</view>
				<!-- salary -->
				<view class="salary mt26 mb40" v-if='data.price==0&&data.price_end==0'>面议</view>
				<view class="salary mt26 mb40" v-else>{{data.price}}-{{data.price_end}}元</view>
				<view class="w240 h104 VIPbox pr" v-if="data.type==2">
					<image src="/static/img/index/11bule-6.png" style="top: 0;left: 0;" class="w-max h-max pa"
						mode="widthFix"></image>
					<text class="pr" style="z-index: 4;">最高结算：<text
							style="color: #FE495D;">{{data.post_subsidy}}</text>元/月</text>
				</view>
			</view>
			<view class="flex mt36 mb32">
				<view class="w102 h40 jobitem-middle mr14" v-for="(item,index) in data.category_name" :key="index">
					{{item}}
				</view>
			</view>

			<view class="flex row-between col-center">
				<!-- 左边 -->
				<view class="w344">
					<u-line-progress active-color="#2979ff" :show-percent="false"
						:percent="(parseInt((data.fictitious_num+data.sign_num)/data.num*100))||100"></u-line-progress>
					<view class="flex row-between mt16">
						<text class="peopNum">已报名{{data.fictitious_num+data.sign_num>=data.num?data.num:data.fictitious_num+data.sign_num||0}}人</text>
						<text class="peopNum">招聘{{data.num||0}}人</text>
					</view>
				</view>
				<!-- 右边 申请盒子 如过是我的申请页面就隐藏 v-show-->
				<view class="h54 w140 jobitem-btn" @tap.stop="applyCollar(data.id)">申请</view>
			</view>

			<!-- 分割线盒子  如果不是我的申请页面就隐藏 -->
			<view class="line"></view>
			<!-- //分割线盒子  如果不是我的申请页面就隐藏 -->

			<!-- 申请时间盒子  如果不是我的申请页面就隐藏 -->
			<view class="applytime">
				<text>发布时间：</text>
				<text class="applytimetxt">{{data.createtime}}</text>
			</view>
			<!-- //申请时间盒子  如果不是我的申请页面就隐藏 -->
		</view>
	</view>
</template>

<script>
	export default {
		name: "blueJobList",
		props: {
			data: {
				default: {}
			},
			type: {
				default: 1
			}
		},
		data() {
			return {
				config: uni.getStorageSync('config')
			};
		},
		onShow() {},
		methods: {
			applyCollar(id) {
				let api
				console.log(111,this.data)
				if (this.data.type == 2) { //申请蓝领职位
					api = 'applyCollar'
				} else if (this.data.type == 1) { //申请猎聘职位
					api = 'applyPosition'
				} else if (this.data.type == 3) { //申请猎聘职位
					api = 'inapplyPosition'
				}
				if (!api) {
					return
				}
				this.$api[api]({
					id
				}).then(res => {
					this.$msg(res.msg)
				})
			},
		}
	}
</script>

<style lang="scss">
	.jobitem {
		position: relative;
		background: #FFFFFF;
		box-shadow: 0px 6rpx 20rpx 0px #E8EAEF;
		border-radius: 14rpx;

		.jobtit {
			font-size: 30rpx;
			color: #0C162E;
		}

		.jobitem-middle {
			text-align: center;
			line-height: 40rpx;
			background: #F1F3F5;
			border-radius: 6rpx;
			font-size: 22rpx;
			color: #6D788B;
		}

		.salary {
			font-size: 34rpx;
			color: #FF286A;
		}

		.peopNum {
			font-size: 22rpx;
			color: #6D788B;
		}

		.jobitem-btn {
			text-align: center;
			line-height: 54rpx;
			background: #1385FF;
			border-radius: 10rpx;
			color: #FFFFFF;
		}

		.VIPbox {
			position: absolute;
			right: 0;
			top: 0;
			background-image: url('/static/img/index/11bule-6.png');
			background-size: 100% 100%;
			font-size: 22rpx;
			color: #A24301;
			text-align: center;
			line-height: 140rpx;
		}
	}

	.line {
		width: 100%;
		height: 2rpx;
		background: #D2DEEB;
		margin: 40rpx 0;
	}

	.applytime {
		text {
			font-size: 24rpx;
			font-weight: 500;
			color: #6D788B;
		}

		.applytimetxt {
			color: #0C162E;
		}
	}
</style>
